SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_rpg.mdl"
SWEP.WorldModel		= "models/weapons/w_rocket_launcher.mdl"
SWEP.AnimPrefix		= "rpg"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Recoil			= 1
SWEP.Primary.Damage			= 0
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone			= 0.04
SWEP.Primary.ClipSize		= -1
SWEP.Primary.Delay			= 1.5
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "none"

SWEP.Secondary.Recoil		= 1
SWEP.Secondary.Damage		= 0
SWEP.Secondary.NumShots		= 0
SWEP.Secondary.Cone			= 0.04
SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.Delay		= 0
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic    = false
SWEP.Secondary.Ammo			= "none"


local ShootSound = Sound( "weapons/flaregun/fire.wav" )

if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	SWEP.HoldType			= "rpg"
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "The BIG"			
	SWEP.Author				= "Zombie"
	SWEP.Slot				= 2
	SWEP.SlotPos			= 0
	SWEP.Contact			= ""
	SWEP.Purpose			= "WBgun"
	SWEP.Instructions		= "Leftclik:Shoot balls"
	
end

function SWEP:Initialize()
   --self.Weapon:SetColor(Color(40,40,40,255))
end

function SWEP:LaunchBall( )
	if (!SERVER) then return end
	local RandAngles = Angle(math.random(0,360),math.random(0,360),math.random(0,360))
	local ply = self.Owner
	local bola = ents.Create("mega_ball")
		bola:SetPos(ply:GetShootPos())
		bola:SetAngles( RandAngles )
		bola:Spawn()
		bola:Fire("Kill", "", 20)
        bola.iOwner = ply
	    bola.iOwnerTeam = ply:Team()
		
	local bPhys = bola:GetPhysicsObject()
	local Force = ply:GetAimVector() * 10000
	bPhys:ApplyForceCenter(Force)
end

function SWEP:PrimaryAttack( )
	self:LaunchBall()
	self.BaseClass.ShootEffects( self )
	self.Weapon:EmitSound( ShootSound, 75, 110 )
	self.Weapon:SetNextPrimaryFire(CurTime() + self.Primary.Delay)
end
